package com.cn.plugin.service;

import com.cn.plugin.entity.Order;
import com.cn.plugin.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : Hydra
 * @date: 2021/3/10 9:27
 * @version: 1.0
 */
@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public Order getOrder(Long id){
        Order order = orderMapper.selectByOrderId(id);
        return order;
    }

    public Order getOrder(Long id,Integer status){
        Order order = orderMapper.selectByOrderIdAndStatus(id,status);
        return order;
    }


    public List<Order>  getAllOrder(){
        List<Order> orders = orderMapper.selectAll();
        return orders;
    }

    public int updateById(Long id){
        return orderMapper.updateById(id);
    }

}
